package com.zzt.zt_lifecycle;

import android.app.Application;
import android.content.pm.PackageManager;

import androidx.lifecycle.ProcessLifecycleOwner;

import com.zzt.zt_lifecycle.life.ActivityLifecycleObserver;
import com.zzt.zt_lifecycle.life.ApplicationLifecycleObserver;

/**
 * @author: zeting
 * @date: 2022/12/19
 */
public class MApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        /**
         * 注册App生命周期观察者
         */
        ProcessLifecycleOwner.get().getLifecycle().addObserver(new ApplicationLifecycleObserver());

        /**
         * 监听所有的生命周期
         */
        registerActivityLifecycleCallbacks(new ActivityLifecycleObserver());

    }
}
